//
//  WebViewController.m
//  huaxiaTong
//
//  Created by Macx on 2017/11/30.
//  Copyright © 2017年 Macx. All rights reserved.
//

#import "WebViewController.h"
#import "SGWebView.h"

@interface WebViewController ()<SGWebViewDelegate>
@property (nonatomic , strong) SGWebView *webView;

@end

@implementation WebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // 暂时，webH 是登录页面所需要的
    
    CGFloat wH = SCREEN_HEIGHT-64;
    
    if (self.webH) {
        wH = self.webH;
    }
    self.webView = [SGWebView webViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, wH)];
    [self.view addSubview:_webView];
    if (self.urlStr) {
        
        
        [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlStr]]];
    }
    if (self.content) {
        [_webView loadHTMLString:self.content];
        [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    }
    _webView.progressViewColor = kBlueColor;
    _webView.SGQRCodeDelegate = self;
}

- (void)webView:(SGWebView *)webView didFinishLoadWithURL:(NSURL *)url {
    NSLog(@"didFinishLoad");
    if (self.urlStr) {
        self.title = webView.navigationItemTitle;
    }
    [MBProgressHUD hideHUDForView:self.view animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
